define(function(require, exports, module){
	var ajax = require("resource/js/component/ajax.js");
	var urlTool = require("resource/js/component/urlTool.js");
	exports.init=function (){
		ininHtml();
	}
	var clickNode = function (processKey,businessName){
		var urlPath = BASEPATH+'/oa/act/mobile/progressDealPage.HTML?key='+processKey+'&businessName='+urlTool.ToUnicode(businessName);
		window.location.href = urlPath;
		if(window.js&&window.js.changeTitle){
			window.js.changeTitle(businessName,"");
		}
	}
	var ininHtml = function(){
		ajax.init().success(function(code,msg,data){
			if(code==0){
				if(data.total>0){
					var html="";
					var num=0;
					$.each(data.rows,function(i,view){
						if(view.phoneStatus=="0"){
							var lines ="";
							if(num%3==1){
								lines="border-left: 1px solid #dfe0e6;border-right: 1px solid #dfe0e6;";
							}
							html+='<li id="styLi_'+num+'" style="background: url(\''+BASEPATH+view.iconUrl+'\') no-repeat  center 20px;background-size: 46px;'+lines+'">'+
							'<a href="javascript:void(0)" view = \''+JSON.stringify(view)+'\' >'+view.businessName+'</a></li>';
							num++;
						}
					});
					$("#tasks").html(html);
					$("#tasks").find("a").unbind("click");
					$("#tasks").find("a").bind("click",function(){
						var view =JSON.parse($(this).attr('view'));
						if(view!=null&&view.hasOwnProperty("processKey")&&view.hasOwnProperty("businessName")){
							clickNode(view.processKey,view.businessName);
						}
					});
					if(num%3==1){
						$("#styLi_"+(num-1)).css({"border-right":"1px solid #dfe0e6","width":"33.6%"});
					}
				}
			}
		}).error(function(code,msg,datas){
			$(".error").text("请求失败！请检查网络连接，稍后再试").show().delay(2000).hide(0);
		}).post(BASEPATH+"/oa/act/actExBuss/queryActExBussByPage.htm?moudelType=power_type_8"); 
	}
});